package com.chester.springbootseventeen.utils;

import lombok.extern.slf4j.Slf4j;

/**
 * @author chester7cheng
 */

@Slf4j
public class ResultUtils {

    public static ResultMessage<String> fail(String message) {
        ResultMessage<String> resultMessage = new ResultMessage<>();
        resultMessage.setCode(ResultMessage.FAILURE);
        resultMessage.setMessage(message);

        log.trace(resultMessage.toString());
        return resultMessage;
    }

    public static ResultMessage<Object> succeed(Object data) {
        ResultMessage<Object> resultMessage = new ResultMessage<>();
        resultMessage.setCode(ResultMessage.FAILURE);
        resultMessage.setData(data);

        log.trace(resultMessage.toString());
        return resultMessage;
    }
}
